'''
Created on 2011-8-29

@author: Administrator
'''
import ConfigParser

class UploadFileConfig():
    ip = None
    port = None
    username = None
    password = None

class SvnConfig():
    path = None
    user = None
    password = None

class Mail():
    host = None
    port = None
    user = None
    password = None
    sender = None

class ServerConfig():
    ip  = None
    port  = None
    sql_connecter = None
    uploadcfg = UploadFileConfig()
    svncfg = SvnConfig()
    mail = Mail()
    
    def Load(self, filename):
        config  = ConfigParser.ConfigParser()
        config.read(filename)
        self.port  = config.getint('server', 'port')
        self.sql_connecter = config.get('db', 'url')
        
        self.uploadcfg.ip = config.get('upload', 'ip')
        self.uploadcfg.port = config.getint('upload', 'port')
        self.uploadcfg.username = config.get('upload', 'username')
        self.uploadcfg.password = config.get('upload', 'password')
        
        self.svncfg.path = config.get('svn', 'url')
        self.svncfg.user = config.get('svn', 'user')
        self.svncfg.password = config.get('svn', 'password')
        
        self.mail.host = config.get('mail', 'host')
        self.mail.port = config.getint('mail', 'port')
        self.mail.user = config.get('mail', 'user')
        self.mail.password = config.get('mail', 'password')
        self.mail.sender = config.get('mail', 'sender')
                